message("Setup and configure")

myPROJECTNAME=$$basename(_PRO_FILE_)
temp = $$split(myPROJECTNAME, .)
myPROJECTNAME = $$first(temp)
myBUILDDIR = $$clean_path($$_PRO_FILE_PWD_/../Build/$$myPROJECTNAME)
myINTERMEDIATE = "$$myBUILDDIR/Intermediate"
INCLUDEPATH += "$$myINTERMEDIATE"
myLibrary = "$$myBase/Library"
INCLUDEPATH += "$$myLibrary"

CONFIG(release, debug|release) {
    DESTDIR = "$$myBUILDDIR/release"
} else:CONFIG(debug) {
    DESTDIR = "$$myBUILDDIR/debug"
} else {
    DESTDIR = "$$myBUILDDIR/other"
}
OBJECTS_DIR = "$$myINTERMEDIATE/obj"
MOC_DIR = "$$myINTERMEDIATE/moc"
RCC_DIR = "$$myINTERMEDIATE/rcc"
UI_DIR = "$$myINTERMEDIATE/ui"

# Copies the given files to the destination directory
defineTest(copyToDestdir) {
    files = $$1

    for(FILE, files) {
        DDIR = $$DESTDIR

        # Replace slashes in paths with backslashes for Windows
        win32:FILE ~= s,/,\\,g
        win32:DDIR ~= s,/,\\,g

        QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
    }

    export(QMAKE_POST_LINK)
}

myINSTALLDIR="$$my3RDDIR/Install"
macx {
    myINSTALLDIR="$$myINSTALLDIR/OSX"
} else {
    message("REMOVE THIS MESSAGE WHEN PROPERLY SETUP")
    myINSTALLDIR="$$myINSTALLDIR/FIX_ME_IN_folders.pri"
}

my3RDINCUDEDIR = "$$myINSTALLDIR/include"
my3RDLIBDIR = "$$myINSTALLDIR/lib"
INCLUDEPATH += "$$my3RDINCUDEDIR"
DEPENDPATH += "$$my3RDINCUDEDIR"
INCLUDEPATH += "$$my3RDLIBDIR"
DEPENDPATH += "$$my3RDLIBDIR"

LIBS += -L"$$my3RDLIBDIR"

CONFIG(with_icu) {
    include($$myPRIs/_icu.pri)
}
CONFIG(with_boost) {
    include($$myPRIs/_boost.pri)
}
CONFIG(with_bisonflex) {
    include($$myPRIs/_bisonflex.pri)
}
CONFIG(with_caspp) {
    include($$myPRIs/caspp.pri)
}
CONFIG(with_paxer) {
    include($$myPRIs/paxer.pri)
}
